/*
 Navicat Premium Dump SQL

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50744 (5.7.44)
 Source Host           : 127.0.0.1:3306
 Source Schema         : smart_community

 Target Server Type    : MySQL
 Target Server Version : 50744 (5.7.44)
 File Encoding         : 65001

 Date: 06/08/2025 11:28:36
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sc_building
-- ----------------------------
DROP TABLE IF EXISTS `sc_building`;
CREATE TABLE `sc_building` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '楼栋ID',
  `building_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '楼栋名称',
  `building_no` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '楼栋编号',
  `community_id` bigint(20) NOT NULL COMMENT '所属社区ID',
  `building_type` tinyint(1) DEFAULT '1' COMMENT '楼栋类型：1-住宅楼，2-商业楼，3-办公楼，4-综合楼',
  `structure_type` tinyint(1) DEFAULT '1' COMMENT '结构类型：1-框架，2-剪力墙，3-砖混，4-钢结构',
  `floor_count` int(11) NOT NULL COMMENT '楼层数',
  `underground_floor` int(11) DEFAULT '0' COMMENT '地下层数',
  `unit_count` int(11) DEFAULT '0' COMMENT '单元数量',
  `household_count` int(11) DEFAULT '0' COMMENT '户数',
  `elevator_count` int(11) DEFAULT '0' COMMENT '电梯数量',
  `has_elevator` tinyint(1) DEFAULT '0' COMMENT '是否有电梯：0-无，1-有',
  `build_year` year(4) DEFAULT NULL COMMENT '建设年份',
  `completion_date` date DEFAULT NULL COMMENT '竣工日期',
  `area` decimal(10,2) DEFAULT NULL COMMENT '建筑面积(平方米)',
  `land_area` decimal(10,2) DEFAULT NULL COMMENT '占地面积（平方米）',
  `building_height` decimal(10,2) DEFAULT NULL COMMENT '建筑高度（米）',
  `longitude` decimal(10,7) DEFAULT NULL COMMENT '经度',
  `latitude` decimal(10,7) DEFAULT NULL COMMENT '纬度',
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '详细地址',
  `manager_id` bigint(20) DEFAULT NULL COMMENT '楼栋管理员ID',
  `maintenance_company` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '维护公司',
  `images` json DEFAULT NULL COMMENT '楼栋图片（JSON数组）',
  `facilities` json DEFAULT NULL COMMENT '配套设施（JSON格式）',
  `remark` text COLLATE utf8mb4_unicode_ci COMMENT '备注',
  `status` tinyint(1) DEFAULT '1' COMMENT '状态：0-建设中，1-正常使用，2-维修中，3-停用',
  `sort_order` int(11) DEFAULT '0' COMMENT '排序字段',
  `create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `deleted` tinyint(1) DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `version` int(11) DEFAULT '1' COMMENT '版本号',
  `building_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'æ¥¼æ ‹ç¼–å·ï¼Œä½œè€…ï¼šWu.Liang',
  `floors` int(4) DEFAULT NULL COMMENT 'æ¥¼å±‚æ•°ï¼Œä½œè€…ï¼šWu.Liang',
  `units_per_floor` int(4) DEFAULT NULL COMMENT 'æ¯å±‚å•å…ƒæ•°ï¼Œä½œè€…ï¼šWu.Liang',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_community_building` (`community_id`,`building_no`),
  KEY `idx_community_id` (`community_id`),
  KEY `idx_building_type` (`building_type`),
  KEY `idx_manager_id` (`manager_id`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='楼栋信息表';

-- ----------------------------
-- Records of sc_building
-- ----------------------------
BEGIN;
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (1, '1号楼', '1', 1, 1, 1, 18, 1, 4, NULL, 3, 1, 2021, NULL, 8500.00, 9000.00, 100.00, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 1, '2025-06-21 19:21:53', 24, '2025-07-29 13:03:56', 0, 3, '1', NULL, 6);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (2, '2号楼', '2', 2, 1, 1, 7, 0, 3, 72, 2, 1, 2020, NULL, 8500.00, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 2, 1, '2025-06-21 19:21:53', 24, '2025-07-12 13:13:40', 0, 2, '2', NULL, 2);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (3, '3号楼', '3', 3, 1, 1, 3, 0, 2, 100, 3, 1, 2021, NULL, 12000.00, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 3, 1, '2025-06-21 19:21:53', 9, '2025-07-13 00:13:00', 0, 4, '3', NULL, 3);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (4, '皮匠弄7幢', '7', 4, 1, 1, 5, 0, 3, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, '2025-07-12 19:18:10', 1, '2025-07-12 13:13:40', 0, 1, NULL, NULL, 2);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (5, '皮匠弄2幢', '2', 4, 1, 1, 6, 0, 2, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, '2025-07-12 19:41:35', 1, '2025-07-12 13:13:40', 0, 1, NULL, NULL, 2);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (6, '1幢', '001', 5, 1, 1, 4, 0, 2, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 9, '2025-07-12 23:27:02', 24, '2025-07-13 17:10:39', 0, 2, NULL, NULL, 2);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (7, '皮匠弄6幢', '6', 4, 1, 1, 5, 0, 3, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, '2025-07-13 19:22:57', 1, '2025-07-13 19:22:57', 0, 1, NULL, NULL, 2);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (8, 'A幢', 'A1', 1, 1, 1, 2, 3, 2, NULL, 2, 1, 2021, NULL, 10.00, 113.00, 113.00, NULL, NULL, '11111111', NULL, NULL, NULL, NULL, '1111111111', 1, NULL, 24, '2025-07-29 11:02:19', 24, '2025-07-29 11:59:10', 0, 1, NULL, NULL, 4);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (9, '阳光1幢', 'NO1', 2, 2, 1, 2, 2, 4, NULL, 8, 1, NULL, NULL, 101.00, 121.00, 51.00, NULL, NULL, '3333333333333333333', NULL, NULL, NULL, NULL, '333333333333333333333333', 1, NULL, 24, '2025-08-01 11:22:16', 24, '2025-08-01 11:22:59', 0, 1, NULL, NULL, 2);
INSERT INTO `sc_building` (`id`, `building_name`, `building_no`, `community_id`, `building_type`, `structure_type`, `floor_count`, `underground_floor`, `unit_count`, `household_count`, `elevator_count`, `has_elevator`, `build_year`, `completion_date`, `area`, `land_area`, `building_height`, `longitude`, `latitude`, `address`, `manager_id`, `maintenance_company`, `images`, `facilities`, `remark`, `status`, `sort_order`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `building_code`, `floors`, `units_per_floor`) VALUES (10, '阳光B', 'B', 2, 4, 2, 2, 1, 4, 0, 8, 1, 2020, NULL, 100.00, 120.00, 100.00, NULL, NULL, 'BBBBBBBBBBBBBBB', NULL, NULL, NULL, NULL, 'BBBBBBBBBBBB', 1, 0, 24, '2025-08-01 12:20:11', 24, '2025-08-01 12:20:11', 0, 1, NULL, NULL, 2);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
